package com.david.interview.step1;

/**
 * @author David
 * @version V1.0
 * @Package com.david.interview.step1
 * @date 2021/7/2 13:32
 */
public class P03 {
    public static void main(String[] args) {
        Son s1 = new Son();
        System.out.println("======================");
        Son s2 = new Son();
    }
}
class Father{
    private int i=test();
    private static int j=method();
    static {
        System.out.println("(1)");
    }
    Father(){
        System.out.println("(2)");

    }
    {
        System.out.println("(3)");

    }
    //此方法有被子类重写 多态子类实例化的时候 这个方法被重写了  会调用子类的test方法
    public int test() {
        System.out.println("(4)");
        return 1;
    }
    public static int method() {
        System.out.println("(5)");
        return 1;
    }

}
class Son extends Father{
    private int i=test();
    private static int j=method();
    static {
        System.out.println("(6)");
    }
    Son(){
        System.out.println("(7)");

    }

    {
        System.out.println("(8)");

    }
    public int test() {
        System.out.println("(9)");
        return 1;
    }
    public static int method() {
        System.out.println("(10)");
        return 1;
    }
}